import Util from '@/common/js/util.js'
export default {
  namespaced: true,
  state: {
    paginate: {
      currentPage: 1,
      lastPage: 1,
      listRows: 20,
      total: 1
    }
  },
  mutations: {
    SET_PAGINATE: (state, paginate) => {
      var _paginate = state.paginate
      Util.extend(_paginate, paginate)
      state.paginate = _paginate
    }
  },
  actions: {
    setPaginate({
      commit
    }, paginate) {
      commit('SET_PAGINATE', paginate)
    }
  },
  getters: {
    page: state => state.paginate.currentPage,
    count: state => state.paginate.listRows
  }
}
